package com.edu.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;

/**
 * 考试规则表
 * @TableName exam_rules
 */
@TableName(value ="exam_rules")
@Data
public class ExamRules {
    /**
     * 规则ID
     */
    @TableId(type = IdType.AUTO)
    private Long ruleId;

    /**
     * 规则类型
     */
    private Object ruleType;

    /**
     * 提前申请天数限制
     */
    private Integer advanceDays;

    /**
     * 最长考试时长（分钟）
     */
    private Integer maxDuration;

    /**
     * 监考教师配比（考生数：教师数）
     */
    private BigDecimal proctorRatio;

    /**
     * 及格分数
     */
    private BigDecimal passingScore;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ExamRules other = (ExamRules) that;
        return (this.getRuleId() == null ? other.getRuleId() == null : this.getRuleId().equals(other.getRuleId()))
            && (this.getRuleType() == null ? other.getRuleType() == null : this.getRuleType().equals(other.getRuleType()))
            && (this.getAdvanceDays() == null ? other.getAdvanceDays() == null : this.getAdvanceDays().equals(other.getAdvanceDays()))
            && (this.getMaxDuration() == null ? other.getMaxDuration() == null : this.getMaxDuration().equals(other.getMaxDuration()))
            && (this.getProctorRatio() == null ? other.getProctorRatio() == null : this.getProctorRatio().equals(other.getProctorRatio()))
            && (this.getPassingScore() == null ? other.getPassingScore() == null : this.getPassingScore().equals(other.getPassingScore()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRuleId() == null) ? 0 : getRuleId().hashCode());
        result = prime * result + ((getRuleType() == null) ? 0 : getRuleType().hashCode());
        result = prime * result + ((getAdvanceDays() == null) ? 0 : getAdvanceDays().hashCode());
        result = prime * result + ((getMaxDuration() == null) ? 0 : getMaxDuration().hashCode());
        result = prime * result + ((getProctorRatio() == null) ? 0 : getProctorRatio().hashCode());
        result = prime * result + ((getPassingScore() == null) ? 0 : getPassingScore().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", ruleId=").append(ruleId);
        sb.append(", ruleType=").append(ruleType);
        sb.append(", advanceDays=").append(advanceDays);
        sb.append(", maxDuration=").append(maxDuration);
        sb.append(", proctorRatio=").append(proctorRatio);
        sb.append(", passingScore=").append(passingScore);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }
}